package com.probiz.estore.common.model.order.base;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.order.OrderAddress;
import com.probiz.estore.common.model.order.OrderShipmentItem;
import com.probiz.estore.common.model.order.SalesOrder;
import com.probiz.estore.core.model.BaseObject;

/**
 * OrderShipment Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class OrderShipmentTbl extends BaseObject implements Serializable {

    protected Integer orderShipmentId;
    /**
     * 单据类型 1=发货单 0=退货单
     */
    protected Short documentType;  
    /**
     * 发/退货单号
     */
	protected String documentNo;
	/**
	 * 物流跟踪号
	 */
	protected String trackingNo;
	/**
	 * 包装费
	 */
	protected BigDecimal wrapCost;
	/**
	 * 包装外键，不使用包装即为NULL
	 */
	protected Integer wrapId;
	/**
	 * 包装名称
	 */
	protected String wrapName;
	/**
	 * 包装祝福语
	 */
	protected String wrapNote;
	/**
	 * 运输公司名称
	 */
	protected String carrierName;
	/**
	 * 运输费用
	 */
	protected BigDecimal shippingCost;
	/**
	 * 运输费率id 
	 */
	protected Integer       shippingRateId;
	/**
	 * 运输方式id
	 */
	protected Integer		shippingMethodId;
	/**
	 * 配送方式描述，例如“货到付款 邮政EMS”，“款到发货 圆通快递”，“自提 中国,广东,广州,先烈中路自提点”等
	 */
	protected String deliveryTypeDesc;
	/**
	 * 送货时间
	 */
	protected String deliveryTime;
	/**
	 * 是否送货前电话确认
	 */
	protected Short needConfrimB4Delivery;
	/**
	 * 客户取货中心ID
	 */
	protected Integer selfCollectionCentreId;
	/**
	 * 客户取货中心名称
	 */
	protected String selfCollectionCentreName;
	/**
	 * 要求提货日期
	 */
	protected Date exceptedSelfCollectDate;
	/**
	 * 实际提货日期
	 */
	protected Date actualSelfCollectDate;
	/**
	 * 退货原因
	 */
	protected String returnReason;
	/**
	 * 备注
	 */
	protected String memo;
	/**
	 * 单据状态
	 */
	protected Short status;
	/**
	 * 快递100查询信息
	 */
	protected String kuaidi100Message;
	/**
	 * 快递100查询时间
	 */
	protected Date kuaidi100QueryTime;
	/**
	 * 指向销售订单
	 */
	protected SalesOrder salesOrder;
	/**
	 * 指向发/退货地址
	 */
	protected OrderAddress shippingAddress;
	/**
	 * 发/退货项单明细项
	 */
	protected Set<OrderShipmentItem> orderShipmentItems = new HashSet<OrderShipmentItem>();
	
	protected Integer version;

	/**
	 * Default Empty Constructor for class OrderShipment
	 */
	public OrderShipmentTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class OrderShipment
	 */
	public OrderShipmentTbl (
		 Integer in_orderShipmentId
        ) {
		this.setOrderShipmentId(in_orderShipmentId);
    }

	
	public com.probiz.estore.common.model.order.SalesOrder getSalesOrder () {
		return salesOrder;
	}	
	
	public void setSalesOrder (com.probiz.estore.common.model.order.SalesOrder in_salesOrder) {
		this.salesOrder = in_salesOrder;
	}
	
	public com.probiz.estore.common.model.order.OrderAddress getShippingAddress () {
		return shippingAddress;
	}	
	
	public void setShippingAddress (com.probiz.estore.common.model.order.OrderAddress in_orderAddress) {
		this.shippingAddress = in_orderAddress;
	}

	public Set<OrderShipmentItem> getOrderShipmentItems () {
		return orderShipmentItems;
	}	
	
	public void setOrderShipmentItems (Set<OrderShipmentItem> in_orderShipmentItems) {
		this.orderShipmentItems = in_orderShipmentItems;
	}
    

	/**
	 * 	 * @return Integer
     * @hibernate.id column="orderShipmentId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getOrderShipmentId() {
		return this.orderShipmentId;
	}
	
	/**
	 * Set the orderShipmentId
	 */	
	public void setOrderShipmentId(Integer aValue) {
		this.orderShipmentId = aValue;
	}	

	/**
	 * 销售订单外键	 * @return Integer
	 */
	public Integer getSalesOrderId() {
		return this.getSalesOrder()==null?null:this.getSalesOrder().getSalesOrderId();
	}
	
	/**
	 * Set the salesOrderId
	 */	
	public void setSalesOrderId(Integer aValue) {
	    if (aValue==null) {
	    	salesOrder = null;
	    } else {
	        salesOrder = new com.probiz.estore.common.model.order.SalesOrder(aValue);
	        salesOrder.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 单据类型
            1=发货单
            0=退货单	 * @return Short
	 * @hibernate.property column="documentType" type="java.lang.Short" length="5" not-null="true" unique="false"
	 */
	public Short getDocumentType() {
		return this.documentType;
	}
	
	/**
	 * Set the documentType
	 * @spring.validator type="required"
	 */	
	public void setDocumentType(Short aValue) {
		this.documentType = aValue;
	}	

	/**
	 * 发/退货地址外键	 * @return Integer
	 */
	public Integer getShippingAddressId() {
		return this.getShippingAddress()==null?null:this.getShippingAddress().getOrderAddressId();
	}
	
	/**
	 * Set the shippingAddressId
	 */	
	public void setShippingAddressId(Integer aValue) {
	    if (aValue==null) {
	    	shippingAddress = null;
	    } else {
	        shippingAddress = new com.probiz.estore.common.model.order.OrderAddress(aValue);
	        shippingAddress.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 发/退货单号	 * @return String
	 * @hibernate.property column="documentNo" type="java.lang.String" length="32" not-null="true" unique="false"
	 */
	public String getDocumentNo() {
		return this.documentNo;
	}
	
	/**
	 * Set the documentNo
	 * @spring.validator type="required"
	 */	
	public void setDocumentNo(String aValue) {
		this.documentNo = aValue;
	}	

	/**
	 * 物流跟踪号	 * @return String
	 * @hibernate.property column="trackingNo" type="java.lang.String" length="128" not-null="false" unique="false"
	 */
	public String getTrackingNo() {
		return this.trackingNo;
	}
	
	/**
	 * Set the trackingNo
	 */	
	public void setTrackingNo(String aValue) {
		this.trackingNo = aValue;
	}	

	/**
	 * 包装费	 * @return java.math.BigDecimal
	 * @hibernate.property column="wrapCost" type="java.math.BigDecimal" length="12" not-null="false" unique="false"
	 */
	public java.math.BigDecimal getWrapCost() {
		return this.wrapCost;
	}
	
	/**
	 * Set the wrapCost
	 */	
	public void setWrapCost(java.math.BigDecimal aValue) {
		this.wrapCost = aValue;
	}	

	/**
	 * 包装外键，不使用包装即为NULL	 * @return Integer
	 * @hibernate.property column="wrapId" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getWrapId() {
		return this.wrapId;
	}
	
	/**
	 * Set the wrapId
	 */	
	public void setWrapId(Integer aValue) {
		this.wrapId = aValue;
	}	

	/**
	 * 包装名称	 * @return String
	 * @hibernate.property column="wrapName" type="java.lang.String" length="64" not-null="false" unique="false"
	 */
	public String getWrapName() {
		return this.wrapName;
	}
	
	/**
	 * Set the wrapName
	 */	
	public void setWrapName(String aValue) {
		this.wrapName = aValue;
	}	

	/**
	 * 包装祝福语	 * @return String
	 * @hibernate.property column="wrapNote" type="java.lang.String" length="512" not-null="false" unique="false"
	 */
	public String getWrapNote() {
		return this.wrapNote;
	}
	
	/**
	 * Set the wrapNote
	 */	
	public void setWrapNote(String aValue) {
		this.wrapNote = aValue;
	}	

	/**
	 * 运输公司名称	 * @return String
	 * @hibernate.property column="carrierName" type="java.lang.String" length="128" not-null="false" unique="false"
	 */
	public String getCarrierName() {
		return this.carrierName;
	}
	
	/**
	 * Set the carrierName
	 */	
	public void setCarrierName(String aValue) {
		this.carrierName = aValue;
	}	

	/**
	 * 运输费用	 * @return java.math.BigDecimal
	 * @hibernate.property column="shippingCost" type="java.math.BigDecimal" length="12" not-null="false" unique="false"
	 */
	public java.math.BigDecimal getShippingCost() {
		return this.shippingCost;
	}
	
	/**
	 * Set the shippingCost
	 */	
	public void setShippingCost(java.math.BigDecimal aValue) {
		this.shippingCost = aValue;
	}	

	
	public Integer getShippingRateId() {
		return shippingRateId;
	}

	public void setShippingRateId(Integer shippingRateId) {
		this.shippingRateId = shippingRateId;
	}

	/**
	 * 运输方式id	 * @return Integer
	 * @hibernate.property column="shippingMethodId" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getShippingMethodId() {
		return this.shippingMethodId;
	}
	
	/**
	 * Set the shippingMethodId
	 */	
	public void setShippingMethodId(Integer aValue) {
		this.shippingMethodId = aValue;
	}	

	/**
	 * 配送方式描述，例如货到付款等	 * @return String
	 * @hibernate.property column="deliveryTypeDesc" type="java.lang.String" length="256" not-null="false" unique="false"
	 */
	public String getDeliveryTypeDesc() {
		return this.deliveryTypeDesc;
	}
	
	/**
	 * Set the deliveryTypeDesc
	 */	
	public void setDeliveryTypeDesc(String aValue) {
		this.deliveryTypeDesc = aValue;
	}	

	/**
	 * 送货时间	 * @return String
	 * @hibernate.property column="deliveryTime" type="java.lang.String" length="32" not-null="false" unique="false"
	 */
	public String getDeliveryTime() {
		return this.deliveryTime;
	}
	
	/**
	 * Set the deliveryTime
	 */	
	public void setDeliveryTime(String aValue) {
		this.deliveryTime = aValue;
	}	


	public Short getNeedConfrimB4Delivery() {
		return needConfrimB4Delivery;
	}

	public void setNeedConfrimB4Delivery(Short needConfrimB4Delivery) {
		this.needConfrimB4Delivery = needConfrimB4Delivery;
	}

	/**
	 * 客户取货中心ID	 * @return Integer
	 * @hibernate.property column="selfCollectionCentreId" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getSelfCollectionCentreId() {
		return this.selfCollectionCentreId;
	}
	
	/**
	 * Set the selfCollectionCentreId
	 */	
	public void setSelfCollectionCentreId(Integer aValue) {
		this.selfCollectionCentreId = aValue;
	}	

	/**
	 * 客户取货中心名称	 * @return String
	 * @hibernate.property column="selfCollectionCentreName" type="java.lang.String" length="64" not-null="false" unique="false"
	 */
	public String getSelfCollectionCentreName() {
		return this.selfCollectionCentreName;
	}
	
	/**
	 * Set the selfCollectionCentreName
	 */	
	public void setSelfCollectionCentreName(String aValue) {
		this.selfCollectionCentreName = aValue;
	}	

	/**
	 * 要求提货日期	 * @return Date
	 * @hibernate.property column="exceptedSelfCollectDate" type="Date" length="19" not-null="false" unique="false"
	 */
	public Date getExceptedSelfCollectDate() {
		return this.exceptedSelfCollectDate;
	}
	
	/**
	 * Set the exceptedSelfCollectDate
	 */	
	public void setExceptedSelfCollectDate(Date aValue) {
		this.exceptedSelfCollectDate = aValue;
	}	

	/**
	 * 实际提货日期	 * @return Date
	 * @hibernate.property column="actualSelfCollectDate" type="Date" length="19" not-null="false" unique="false"
	 */
	public Date getActualSelfCollectDate() {
		return this.actualSelfCollectDate;
	}
	
	/**
	 * Set the actualSelfCollectDate
	 */	
	public void setActualSelfCollectDate(Date aValue) {
		this.actualSelfCollectDate = aValue;
	}	

	
	public String getReturnReason() {
		return returnReason;
	}

	public void setReturnReason(String returnReason) {
		this.returnReason = returnReason;
	}

	/**
	 * 	 * @return String
	 * @hibernate.property column="memo" type="java.lang.String" length="1024" not-null="false" unique="false"
	 */
	public String getMemo() {
		return this.memo;
	}
	
	/**
	 * Set the memo
	 */	
	public void setMemo(String aValue) {
		this.memo = aValue;
	}	

	/**
	 * 单据状态	 * @return Short
	 * @hibernate.property column="status" type="java.lang.Short" length="5" not-null="false" unique="false"
	 */
	public Short getStatus() {
		return this.status;
	}
	
	/**
	 * Set the status
	 */	
	public void setStatus(Short aValue) {
		this.status = aValue;
	}	

	
	public String getKuaidi100Message() {
		return kuaidi100Message;
	}

	public void setKuaidi100Message(String kuaidi100Message) {
		this.kuaidi100Message = kuaidi100Message;
	}

	public Date getKuaidi100QueryTime() {
		return kuaidi100QueryTime;
	}

	public void setKuaidi100QueryTime(Date kuaidi100QueryTime) {
		this.kuaidi100QueryTime = kuaidi100QueryTime;
	}

	/**
	 * 	 * @return Date
	 * @hibernate.property column="createTime" type="Date" length="19" not-null="true" unique="false"
	 */
	public Date getCreateTime() {
		return this.createTime;
	}
	
	/**
	 * Set the createTime
	 * @spring.validator type="required"
	 */	
	public void setCreateTime(Date aValue) {
		this.createTime = aValue;
	}	

	/**
	 * 	 * @return Date
	 * @hibernate.property column="updateTime" type="Date" length="19" not-null="true" unique="false"
	 */
	public Date getUpdateTime() {
		return this.updateTime;
	}
	
	/**
	 * Set the updateTime
	 * @spring.validator type="required"
	 */	
	public void setUpdateTime(Date aValue) {
		this.updateTime = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="createBy" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getCreateBy() {
		return this.createBy;
	}
	
	/**
	 * Set the createBy
	 */	
	public void setCreateBy(Integer aValue) {
		this.createBy = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="updateBy" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getUpdateBy() {
		return this.updateBy;
	}
	
	/**
	 * Set the updateBy
	 */	
	public void setUpdateBy(Integer aValue) {
		this.updateBy = aValue;
	}	

	/**
	 * 	 * @return Integer
	 * @hibernate.property column="version" type="java.lang.Integer" length="10" not-null="true" unique="false"
	 */
	public Integer getVersion() {
		return this.version;
	}
	
	/**
	 * Set the version
	 * @spring.validator type="required"
	 */	
	public void setVersion(Integer aValue) {
		this.version = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof OrderShipmentTbl)) {
			return false;
		}
		OrderShipmentTbl rhs = (OrderShipmentTbl) object;
		return new EqualsBuilder()
				.append(this.orderShipmentId, rhs.orderShipmentId)
						.append(this.documentType, rhs.documentType)
						.append(this.documentNo, rhs.documentNo)
				.append(this.trackingNo, rhs.trackingNo)
				.append(this.wrapCost, rhs.wrapCost)
				.append(this.wrapId, rhs.wrapId)
				.append(this.wrapName, rhs.wrapName)
				.append(this.wrapNote, rhs.wrapNote)
				.append(this.carrierName, rhs.carrierName)
				.append(this.shippingCost, rhs.shippingCost)
				.append(this.shippingMethodId, rhs.shippingMethodId)
				.append(this.deliveryTypeDesc, rhs.deliveryTypeDesc)
				.append(this.deliveryTime, rhs.deliveryTime)
				.append(this.needConfrimB4Delivery, rhs.needConfrimB4Delivery)
				.append(this.selfCollectionCentreId, rhs.selfCollectionCentreId)
				.append(this.selfCollectionCentreName, rhs.selfCollectionCentreName)
				.append(this.exceptedSelfCollectDate, rhs.exceptedSelfCollectDate)
				.append(this.actualSelfCollectDate, rhs.actualSelfCollectDate)
				.append(this.memo, rhs.memo)
				.append(this.status, rhs.status)
				.append(this.createTime, rhs.createTime)
				.append(this.updateTime, rhs.updateTime)
				.append(this.createBy, rhs.createBy)
				.append(this.updateBy, rhs.updateBy)
				.append(this.version, rhs.version)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.orderShipmentId) 
						.append(this.documentType) 
						.append(this.documentNo) 
				.append(this.trackingNo) 
				.append(this.wrapCost) 
				.append(this.wrapId) 
				.append(this.wrapName) 
				.append(this.wrapNote) 
				.append(this.carrierName) 
				.append(this.shippingCost) 
				.append(this.shippingMethodId) 
				.append(this.deliveryTypeDesc) 
				.append(this.deliveryTime) 
				.append(this.needConfrimB4Delivery) 
				.append(this.selfCollectionCentreId) 
				.append(this.selfCollectionCentreName) 
				.append(this.exceptedSelfCollectDate) 
				.append(this.actualSelfCollectDate) 
				.append(this.memo) 
				.append(this.status) 
				.append(this.createTime) 
				.append(this.updateTime) 
				.append(this.createBy) 
				.append(this.updateBy) 
				.append(this.version) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("orderShipmentId", this.orderShipmentId) 
						.append("documentType", this.documentType) 
						.append("shipmentNo", this.documentNo) 
				.append("trackingNo", this.trackingNo) 
				.append("wrapCost", this.wrapCost) 
				.append("wrapId", this.wrapId) 
				.append("wrapName", this.wrapName) 
				.append("wrapNote", this.wrapNote) 
				.append("carrierName", this.carrierName) 
				.append("shippingCost", this.shippingCost) 
				.append("shippingMethodId", this.shippingMethodId) 
				.append("deliveryType", this.deliveryTypeDesc) 
				.append("deliveryTime", this.deliveryTime) 
				.append("needConfrimB4Delivery", this.needConfrimB4Delivery) 
				.append("selfCollectionCentreId", this.selfCollectionCentreId) 
				.append("selfCollectionCentreName", this.selfCollectionCentreName) 
				.append("exceptedSelfCollectDate", this.exceptedSelfCollectDate) 
				.append("actualSelfCollectDate", this.actualSelfCollectDate) 
				.append("memo", this.memo) 
				.append("status", this.status) 
				.append("createTime", this.createTime) 
				.append("updateTime", this.updateTime) 
				.append("createBy", this.createBy) 
				.append("updateBy", this.updateBy) 
				.append("version", this.version) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "orderShipmentId";
	}
	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return orderShipmentId;
	}

}